import { Component } from '@angular/core';
import { IonicPage, NavController, NavParams } from 'ionic-angular';

import { ProductListPage } from '../product-list/product-list';

/**
 * Generated class for the CurrentOrderPage page.
 *
 * See http://ionicframework.com/docs/components/#navigation for more info
 * on Ionic pages and navigation.
 */
@IonicPage()
@Component({
  selector: 'page-current-order',
  templateUrl: 'current-order.html',
})
export class CurrentOrderPage {

  productListPage: any = ProductListPage;
  categoryList: Array<{id: number, name: string}>;
  summaryCollapsed: boolean = true;
  order: any;

  constructor(public navCtrl: NavController, public navParams: NavParams) {

    // sample code
    this.categoryList = [
      { id: 1, name: 'Red' },
      { id: 2, name: 'Orange' },
      { id: 3, name: 'Yellow' },
      { id: 4, name: 'Green' },
      { id: 5, name: 'Blue' },
      { id: 2, name: 'Orange' },
      { id: 3, name: 'Yellow' },
      { id: 4, name: 'Green' },
      { id: 5, name: 'Blue' }
    ];
    this.order = {
      items: [
        {
          photo: 'images/p01.png',
          name: 'Lunch Set A',
          desc: 'Beef, Cheese, Tea',
          qty: 1,
          unitPrice: 268,
          status: 0 // 0: ordered, 1: preparing, 2: served
        },
        {
          photo: 'images/p01.png',
          name: 'Lunch Set B',
          desc: 'Beef, Cheese, Tea',
          qty: 2,
          unitPrice: 268,
          status: 1 // 0: ordered, 1: preparing, 2: served
        },
        {
          photo: 'images/p01.png',
          name: 'Lunch Set C',
          desc: 'Beef, Cheese, Tea',
          qty: 3,
          unitPrice: 268,
          status: 2 // 0: ordered, 1: preparing, 2: served
        },
        {
          photo: 'images/p01.png',
          name: 'Lunch Set A',
          desc: 'Beef, Cheese, Tea',
          qty: 1,
          unitPrice: 268,
          status: 0 // 0: ordered, 1: preparing, 2: served
        },
        {
          photo: 'images/p01.png',
          name: 'Lunch Set B',
          desc: 'Beef, Cheese, Tea',
          qty: 2,
          unitPrice: 268,
          status: 1 // 0: ordered, 1: preparing, 2: served
        },
        {
          photo: 'images/p01.png',
          name: 'Lunch Set C',
          desc: 'Beef, Cheese, Tea',
          qty: 3,
          unitPrice: 268,
          status: 2 // 0: ordered, 1: preparing, 2: served
        },
        {
          photo: 'images/p01.png',
          name: 'Lunch Set A',
          desc: 'Beef, Cheese, Tea',
          qty: 1,
          unitPrice: 268,
          status: 0 // 0: ordered, 1: preparing, 2: served
        },
        {
          photo: 'images/p01.png',
          name: 'Lunch Set B',
          desc: 'Beef, Cheese, Tea',
          qty: 2,
          unitPrice: 268,
          status: 1 // 0: ordered, 1: preparing, 2: served
        },
        {
          photo: 'images/p01.png',
          name: 'Lunch Set C',
          desc: 'Beef, Cheese, Tea',
          qty: 3,
          unitPrice: 268,
          status: 2 // 0: ordered, 1: preparing, 2: served
        },
        {
          photo: 'images/p01.png',
          name: 'Lunch Set A',
          desc: 'Beef, Cheese, Tea',
          qty: 1,
          unitPrice: 268,
          status: 0 // 0: ordered, 1: preparing, 2: served
        },
        {
          photo: 'images/p01.png',
          name: 'Lunch Set B',
          desc: 'Beef, Cheese, Tea',
          qty: 2,
          unitPrice: 268,
          status: 1 // 0: ordered, 1: preparing, 2: served
        },
        {
          photo: 'images/p01.png',
          name: 'Lunch Set C',
          desc: 'Beef, Cheese, Tea',
          qty: 3,
          unitPrice: 268,
          status: 2 // 0: ordered, 1: preparing, 2: served
        },
      ]
    };

  }

  // toggle order summary
  toggleSummary() {
    this.summaryCollapsed = !this.summaryCollapsed;
  }

  ionViewDidLoad() {
    console.log('ionViewDidLoad CurrentOrderPage');
  }

}
